package Link;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {
    
    public Connection getConnection() {
        
        String ClassForName = "com.mysql.jdbc.Driver";
        String Driver = "jdbc:mysql:";
        String HostIP = "//127.0.0.1";
        String BancoDados = "/stoquesolution";
        String Login = "root";
        String Senha = "vertrigo";

        try {
            Class.forName(ClassForName);
            return DriverManager.getConnection(Driver + HostIP + BancoDados, Login, Senha);
        } catch (SQLException erro) {
            //JOptionPane.showMessageDialog(null, "Erro de conexão com o Banco");
            throw new RuntimeException(erro);
        } catch (ClassNotFoundException er) {
            //JOptionPane.showMessageDialog(null, "Erro de conexão com o Banco");
            throw new RuntimeException(er);
        }
    } 
    
}
